package com.education.wisdom.service.impl;


import com.education.common.utils.Convert;
import com.education.wisdom.mapper.CatalogUserLikeMapper;
import com.education.wisdom.pojo.CatalogUserLike;
import com.education.wisdom.service.ICatalogUserLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 用户喜欢的课程 服务层实现
 *
 * @author ruoyi
 * @date 2019-02-15
 */
@Service
public class CatalogUserLikeServiceImpl implements ICatalogUserLikeService {
    @Autowired
    private CatalogUserLikeMapper catalogUserLikeMapper;

    /**
     * 查询用户喜欢的课程信息
     *
     * @param id 用户喜欢的课程ID
     * @return 用户喜欢的课程信息
     */
    @Override
    public CatalogUserLike selectCatalogUserLikeById(Integer id) {
        return catalogUserLikeMapper.selectCatalogUserLikeById(id);
    }

    /**
     * 查询用户喜欢的课程列表
     *
     * @param catalogUserLike 用户喜欢的课程信息
     * @return 用户喜欢的课程集合
     */
    @Override
    public List<CatalogUserLike> selectCatalogUserLikeList(CatalogUserLike catalogUserLike) {
        return catalogUserLikeMapper.selectCatalogUserLikeList(catalogUserLike);
    }

    /**
     * 新增用户喜欢的课程
     *
     * @param catalogUserLike 用户喜欢的课程信息
     * @return 结果
     */
    @Override
    public int insertCatalogUserLike(CatalogUserLike catalogUserLike) {
        return catalogUserLikeMapper.insertCatalogUserLike(catalogUserLike);
    }

    /**
     * 修改用户喜欢的课程
     *
     * @param catalogUserLike 用户喜欢的课程信息
     * @return 结果
     */
    @Override
    public int updateCatalogUserLike(CatalogUserLike catalogUserLike) {
        return catalogUserLikeMapper.updateCatalogUserLike(catalogUserLike);
    }

    /**
     * 删除用户喜欢的课程对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCatalogUserLikeByIds(String ids) {
        return catalogUserLikeMapper.deleteCatalogUserLikeByIds(Convert.toStrArray(ids));
    }

    @Override
    public int deleteCatalogUserLikeByuserId(String userId) {
        return catalogUserLikeMapper.deleteCatalogUserLikeByuserId(userId);
    }

    @Override
    public List<CatalogUserLike> selectCatalogUserLikeByUserId(String userId) {
        return catalogUserLikeMapper.selectCatalogUserLikeByUserId(userId);
    }

    @Override
    public CatalogUserLike selectByMap(Map<String, Object> map) {
        return catalogUserLikeMapper.selectByMap(map);
    }

    @Override
    public Integer selectCountByCatalogId(Integer catalogId) {
        return catalogUserLikeMapper.selectCountByCatalogId(catalogId);
    }

}
